const Service = require('egg').Service;
const NacosConfigClient = require('nacos').NacosConfigClient;

// 请求后台接口
class MinprogramService extends Service {
  async maintainMsg() {

    // // 服务配置
    const configClient = new NacosConfigClient({
      serverAddr: '192.168.20.12:8848',
    });
    await configClient.ready();

    // get config once
    const content = await configClient.getConfig('testprop', 'dev');
    console.log('getConfig = ',content);


     configClient.close();
     if (content) {
      return {
        config: content ? true : false
      }
    }

    // const data = await this.ctx.curl('');    // 请求其他接口
    // return content;
  }
}

module.exports = MinprogramService;
